/*
 * @Author: 李瑞清
 * @Date: 2023-02-24 17:28:15
 * @LastEditors: 李瑞清 alger_li@163.com
 * @LastEditTime: 2023-04-12 10:01:26
 * @FilePath: \oms\scprit\followup\app\outPatient\outPatient.js
 * @Description: 
 */
/**
 * @ author: 汪孟苹
 */
define(["jquery", "bbcare",
	"scprit/followup/app/outPatient/outPatient.servers.js",
	"scprit/followup/app/outPatient/outPatient.ui.js",
	"scprit/followup/app/outPatient/outPatient.event.js"
],
	function ($, $bb, $outPatientServers, $outPatientUi, $outPatientEvent) {
		var outPatient = {}

		/**
		 * 基本信息的ui（在该页面进行操作时，不会再发生变化的ui）
		 */
		var remainUi = function (params) {
			$outPatientUi.FollowUpTitInit({		// 问卷的标题
				id: "followUpTit",
				queueName: params.queuename
			})
		}

		outPatient.init = function () {
			$outPatientEvent.initVue()
			getWindowConfigAndSetGlobal()

			var params = $outPatientServers.getPageParams()
			if (params) {
				remainUi(params)
				// var topbars = [
				// 	{
				// 		"icon":"fa fa-trash-o",
				// 		"name":"删除患者",
				// 		"callback":$outPatientEvent.onPatientDelect,
				// 		"params":$outPatientServers.getDeleteParams()
				// 	}
				// ];
				// $bb.toolbar(topbars);
				$outPatientServers.ajaxTasks($outPatientEvent.getTasksCallback, params)		//请求任务列表
				if (params.unchecked && params.unchecked == "1") {
					$("#topbar").css({ "display": "none" })
				}
			} else {
				//患者实例ID不存在时的异常操作代码
				$bb.toastShow("加载门诊录入页面失败")
			}
		}

		/**
		 * 查看全局配置并且暂存到全局 Global 对象
		 * 因为 window._config 会被覆盖
		 */
		var getWindowConfigAndSetGlobal = function () {
			try {
				var config = JSON.parse(window._config)
				window.__global__ = window.__global__ ? window.__global__ : {}
				for (var key in config) {
					window.__global__[key] = config[key]
				}
			} catch (err) {
				console.log('获取 window.config 失败')
			}
		}

		return outPatient
	})